<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Faiss: faiss::HNSW Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Faiss
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Friends</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacefaiss.html">faiss</a></li><li class="navelem"><a class="el" href="structfaiss_1_1HNSW.html">HNSW</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pub-attribs">Public Attributes</a> &#124;
<a href="structfaiss_1_1HNSW-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">faiss::HNSW Struct Reference</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW_1_1MinimaxHeap.html">MinimaxHeap</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW_1_1NodeDistCloser.html">NodeDistCloser</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">to sort pairs of (id, distance) from nearest to fathest or the reverse  <a href="structfaiss_1_1HNSW_1_1NodeDistCloser.html#details">More...</a><br/></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW_1_1NodeDistFarther.html">NodeDistFarther</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:ae1342fc2f07c325598a73b733e88ee74"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae1342fc2f07c325598a73b733e88ee74"></a>
typedef int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#ae1342fc2f07c325598a73b733e88ee74">storage_idx_t</a></td></tr>
<tr class="memdesc:ae1342fc2f07c325598a73b733e88ee74"><td class="mdescLeft">&#160;</td><td class="mdescRight">internal storage of vectors (32 bits: this is expensive) <br/></td></tr>
<tr class="separator:ae1342fc2f07c325598a73b733e88ee74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a84f912f99bda1a827a74cdf8793af160"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a84f912f99bda1a827a74cdf8793af160"></a>
typedef <a class="el" href="structfaiss_1_1Index.html#ad3f0d3071f987baabbdd3da4500c87ea">Index::idx_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a84f912f99bda1a827a74cdf8793af160">idx_t</a></td></tr>
<tr class="memdesc:a84f912f99bda1a827a74cdf8793af160"><td class="mdescLeft">&#160;</td><td class="mdescRight">Faiss results are 64-bit. <br/></td></tr>
<tr class="separator:a84f912f99bda1a827a74cdf8793af160"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7354bfe0fedc510d73071ebefd37dcb2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7354bfe0fedc510d73071ebefd37dcb2"></a>
typedef std::pair&lt; float, <br class="typebreak"/>
<a class="el" href="structfaiss_1_1HNSW.html#ae1342fc2f07c325598a73b733e88ee74">storage_idx_t</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>Node</b></td></tr>
<tr class="separator:a7354bfe0fedc510d73071ebefd37dcb2"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae7d955690da5d6376c203e81e124ba94"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#ae7d955690da5d6376c203e81e124ba94">set_default_probas</a> (int M, float levelMult)</td></tr>
<tr class="separator:ae7d955690da5d6376c203e81e124ba94"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afdb5a17487296267efaaa94e6a08996d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afdb5a17487296267efaaa94e6a08996d"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#afdb5a17487296267efaaa94e6a08996d">set_nb_neighbors</a> (int level_no, int n)</td></tr>
<tr class="memdesc:afdb5a17487296267efaaa94e6a08996d"><td class="mdescLeft">&#160;</td><td class="mdescRight">set nb of neighbors for this level (before adding anything) <br/></td></tr>
<tr class="separator:afdb5a17487296267efaaa94e6a08996d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad497ea80f352c33242ba7835370c2dba"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad497ea80f352c33242ba7835370c2dba"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#ad497ea80f352c33242ba7835370c2dba">nb_neighbors</a> (int layer_no) const </td></tr>
<tr class="memdesc:ad497ea80f352c33242ba7835370c2dba"><td class="mdescLeft">&#160;</td><td class="mdescRight">nb of neighbors for this level <br/></td></tr>
<tr class="separator:ad497ea80f352c33242ba7835370c2dba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a49b512eaaa54ead77b564cad8e3e6ebd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a49b512eaaa54ead77b564cad8e3e6ebd"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a49b512eaaa54ead77b564cad8e3e6ebd">cum_nb_neighbors</a> (int layer_no) const </td></tr>
<tr class="memdesc:a49b512eaaa54ead77b564cad8e3e6ebd"><td class="mdescLeft">&#160;</td><td class="mdescRight">cumumlative nb up to (and excluding) this level <br/></td></tr>
<tr class="separator:a49b512eaaa54ead77b564cad8e3e6ebd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa3ae6a80d358e59e3af23f918253f61d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa3ae6a80d358e59e3af23f918253f61d"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#aa3ae6a80d358e59e3af23f918253f61d">neighbor_range</a> (<a class="el" href="structfaiss_1_1HNSW.html#a84f912f99bda1a827a74cdf8793af160">idx_t</a> no, int layer_no, size_t *begin, size_t *end) const </td></tr>
<tr class="memdesc:aa3ae6a80d358e59e3af23f918253f61d"><td class="mdescLeft">&#160;</td><td class="mdescRight">range of entries in the neighbors table of vertex no at layer_no <br/></td></tr>
<tr class="separator:aa3ae6a80d358e59e3af23f918253f61d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1fc852810a2497a8eb2c41635ec05520"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1fc852810a2497a8eb2c41635ec05520"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a1fc852810a2497a8eb2c41635ec05520">HNSW</a> (int M=32)</td></tr>
<tr class="memdesc:a1fc852810a2497a8eb2c41635ec05520"><td class="mdescLeft">&#160;</td><td class="mdescRight">only mandatory parameter: nb of neighbors <br/></td></tr>
<tr class="separator:a1fc852810a2497a8eb2c41635ec05520"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa6dfdaed7bc0ad895774315166fcb197"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa6dfdaed7bc0ad895774315166fcb197"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#aa6dfdaed7bc0ad895774315166fcb197">random_level</a> ()</td></tr>
<tr class="memdesc:aa6dfdaed7bc0ad895774315166fcb197"><td class="mdescLeft">&#160;</td><td class="mdescRight">pick a random level for a new point <br/></td></tr>
<tr class="separator:aa6dfdaed7bc0ad895774315166fcb197"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a26710980aaca3c1c8729e5e055a42ebe"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a26710980aaca3c1c8729e5e055a42ebe"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a26710980aaca3c1c8729e5e055a42ebe">fill_with_random_links</a> (size_t n)</td></tr>
<tr class="memdesc:a26710980aaca3c1c8729e5e055a42ebe"><td class="mdescLeft">&#160;</td><td class="mdescRight">add n random levels to table (for debugging...) <br/></td></tr>
<tr class="separator:a26710980aaca3c1c8729e5e055a42ebe"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a41a5d502f7b17a0fca8d1b0c02123a24"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a41a5d502f7b17a0fca8d1b0c02123a24">add_links_starting_from</a> (<a class="el" href="structfaiss_1_1DistanceComputer.html">DistanceComputer</a> &amp;ptdis, <a class="el" href="structfaiss_1_1HNSW.html#ae1342fc2f07c325598a73b733e88ee74">storage_idx_t</a> pt_id, <a class="el" href="structfaiss_1_1HNSW.html#ae1342fc2f07c325598a73b733e88ee74">storage_idx_t</a> nearest, float d_nearest, int level, omp_lock_t *locks, <a class="el" href="structfaiss_1_1VisitedTable.html">VisitedTable</a> &amp;vt)</td></tr>
<tr class="separator:a41a5d502f7b17a0fca8d1b0c02123a24"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a314b809de6f329662ab09f258b49afb3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a314b809de6f329662ab09f258b49afb3">add_with_locks</a> (<a class="el" href="structfaiss_1_1DistanceComputer.html">DistanceComputer</a> &amp;ptdis, int pt_level, int pt_id, std::vector&lt; omp_lock_t &gt; &amp;locks, <a class="el" href="structfaiss_1_1VisitedTable.html">VisitedTable</a> &amp;vt)</td></tr>
<tr class="separator:a314b809de6f329662ab09f258b49afb3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad91ac2e25c896dab7fb9d32f94b60a6a"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#ad91ac2e25c896dab7fb9d32f94b60a6a">search_from_candidates</a> (<a class="el" href="structfaiss_1_1DistanceComputer.html">DistanceComputer</a> &amp;qdis, int k, <a class="el" href="structfaiss_1_1HNSW.html#a84f912f99bda1a827a74cdf8793af160">idx_t</a> *I, float *D, <a class="el" href="structfaiss_1_1HNSW_1_1MinimaxHeap.html">MinimaxHeap</a> &amp;candidates, <a class="el" href="structfaiss_1_1VisitedTable.html">VisitedTable</a> &amp;vt, int level, int nres_in=0) const </td></tr>
<tr class="separator:ad91ac2e25c896dab7fb9d32f94b60a6a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a749c4432f48105a79b4d11ac02a3a68e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a749c4432f48105a79b4d11ac02a3a68e"></a>
std::priority_queue&lt; Node &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>search_from_candidate_unbounded</b> (const Node &amp;node, <a class="el" href="structfaiss_1_1DistanceComputer.html">DistanceComputer</a> &amp;qdis, int ef, <a class="el" href="structfaiss_1_1VisitedTable.html">VisitedTable</a> *vt) const </td></tr>
<tr class="separator:a749c4432f48105a79b4d11ac02a3a68e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a330107a5801680609932849fc9404594"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a330107a5801680609932849fc9404594"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a330107a5801680609932849fc9404594">search</a> (<a class="el" href="structfaiss_1_1DistanceComputer.html">DistanceComputer</a> &amp;qdis, int k, <a class="el" href="structfaiss_1_1HNSW.html#a84f912f99bda1a827a74cdf8793af160">idx_t</a> *I, float *D, <a class="el" href="structfaiss_1_1VisitedTable.html">VisitedTable</a> &amp;vt) const </td></tr>
<tr class="memdesc:a330107a5801680609932849fc9404594"><td class="mdescLeft">&#160;</td><td class="mdescRight">search interface <br/></td></tr>
<tr class="separator:a330107a5801680609932849fc9404594"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a73b4779053c5281298e1e916bb04d42f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a73b4779053c5281298e1e916bb04d42f"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>reset</b> ()</td></tr>
<tr class="separator:a73b4779053c5281298e1e916bb04d42f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab0455aedd431a165dea13bac2548066f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab0455aedd431a165dea13bac2548066f"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>clear_neighbor_tables</b> (int level)</td></tr>
<tr class="separator:ab0455aedd431a165dea13bac2548066f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7099f143f721ce74d7b4f5f3f66a7e5c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7099f143f721ce74d7b4f5f3f66a7e5c"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>print_neighbor_stats</b> (int level) const </td></tr>
<tr class="separator:a7099f143f721ce74d7b4f5f3f66a7e5c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a805fdc261eb2d1fa66e6a457d7cde2a0"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a805fdc261eb2d1fa66e6a457d7cde2a0"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>prepare_level_tab</b> (size_t n, bool preset_levels=false)</td></tr>
<tr class="separator:a805fdc261eb2d1fa66e6a457d7cde2a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a0cf1870a859783925e95b15bf5e83584"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a0cf1870a859783925e95b15bf5e83584">shrink_neighbor_list</a> (<a class="el" href="structfaiss_1_1DistanceComputer.html">DistanceComputer</a> &amp;qdis, std::priority_queue&lt; <a class="el" href="structfaiss_1_1HNSW_1_1NodeDistFarther.html">NodeDistFarther</a> &gt; &amp;input, std::vector&lt; <a class="el" href="structfaiss_1_1HNSW_1_1NodeDistFarther.html">NodeDistFarther</a> &gt; &amp;output, int max_size)</td></tr>
<tr class="separator:a0cf1870a859783925e95b15bf5e83584"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-attribs"></a>
Public Attributes</h2></td></tr>
<tr class="memitem:a907c94e0eca5200af1dc8d0aea482665"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a907c94e0eca5200af1dc8d0aea482665"></a>
std::vector&lt; double &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a907c94e0eca5200af1dc8d0aea482665">assign_probas</a></td></tr>
<tr class="memdesc:a907c94e0eca5200af1dc8d0aea482665"><td class="mdescLeft">&#160;</td><td class="mdescRight">assignment probability to each layer (sum=1) <br/></td></tr>
<tr class="separator:a907c94e0eca5200af1dc8d0aea482665"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1c258bb88aae9b1a754ab4690d85ed41"><td class="memItemLeft" align="right" valign="top">std::vector&lt; int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a1c258bb88aae9b1a754ab4690d85ed41">cum_nneighbor_per_level</a></td></tr>
<tr class="separator:a1c258bb88aae9b1a754ab4690d85ed41"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a44847954c98957404829182c7db1b8af"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a44847954c98957404829182c7db1b8af"></a>
std::vector&lt; int &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a44847954c98957404829182c7db1b8af">levels</a></td></tr>
<tr class="memdesc:a44847954c98957404829182c7db1b8af"><td class="mdescLeft">&#160;</td><td class="mdescRight">level of each vector (base level = 1), size = ntotal <br/></td></tr>
<tr class="separator:a44847954c98957404829182c7db1b8af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0b456c521194903b29ce7c157539d771"><td class="memItemLeft" align="right" valign="top">std::vector&lt; size_t &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a0b456c521194903b29ce7c157539d771">offsets</a></td></tr>
<tr class="separator:a0b456c521194903b29ce7c157539d771"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a27bd11ef9a651a94bcefa5291336fc58"><td class="memItemLeft" align="right" valign="top">std::vector&lt; <a class="el" href="structfaiss_1_1HNSW.html#ae1342fc2f07c325598a73b733e88ee74">storage_idx_t</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a27bd11ef9a651a94bcefa5291336fc58">neighbors</a></td></tr>
<tr class="separator:a27bd11ef9a651a94bcefa5291336fc58"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a95547d97c90b361a040bae0fb0d892b4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a95547d97c90b361a040bae0fb0d892b4"></a>
<a class="el" href="structfaiss_1_1HNSW.html#ae1342fc2f07c325598a73b733e88ee74">storage_idx_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a95547d97c90b361a040bae0fb0d892b4">entry_point</a></td></tr>
<tr class="memdesc:a95547d97c90b361a040bae0fb0d892b4"><td class="mdescLeft">&#160;</td><td class="mdescRight">entry point in the search structure (one of the points with maximum level <br/></td></tr>
<tr class="separator:a95547d97c90b361a040bae0fb0d892b4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae551102a7eda0b853ad85793987e46a2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae551102a7eda0b853ad85793987e46a2"></a>
<a class="el" href="structfaiss_1_1RandomGenerator.html">faiss::RandomGenerator</a>&#160;</td><td class="memItemRight" valign="bottom"><b>rng</b></td></tr>
<tr class="separator:ae551102a7eda0b853ad85793987e46a2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afba18a290f5f759a8a7a64ed35b950eb"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afba18a290f5f759a8a7a64ed35b950eb"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#afba18a290f5f759a8a7a64ed35b950eb">max_level</a></td></tr>
<tr class="memdesc:afba18a290f5f759a8a7a64ed35b950eb"><td class="mdescLeft">&#160;</td><td class="mdescRight">maximum level <br/></td></tr>
<tr class="separator:afba18a290f5f759a8a7a64ed35b950eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa7309dd7826761def38233c8bbbc0c63"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa7309dd7826761def38233c8bbbc0c63"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#aa7309dd7826761def38233c8bbbc0c63">efConstruction</a></td></tr>
<tr class="memdesc:aa7309dd7826761def38233c8bbbc0c63"><td class="mdescLeft">&#160;</td><td class="mdescRight">expansion factor at construction time <br/></td></tr>
<tr class="separator:aa7309dd7826761def38233c8bbbc0c63"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6d1cb35c4220bf554af90133c71ae04f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6d1cb35c4220bf554af90133c71ae04f"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a6d1cb35c4220bf554af90133c71ae04f">efSearch</a></td></tr>
<tr class="memdesc:a6d1cb35c4220bf554af90133c71ae04f"><td class="mdescLeft">&#160;</td><td class="mdescRight">expansion factor at search time <br/></td></tr>
<tr class="separator:a6d1cb35c4220bf554af90133c71ae04f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adbf81f0b21102b942182c904892e0858"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adbf81f0b21102b942182c904892e0858"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#adbf81f0b21102b942182c904892e0858">check_relative_distance</a> = true</td></tr>
<tr class="memdesc:adbf81f0b21102b942182c904892e0858"><td class="mdescLeft">&#160;</td><td class="mdescRight">during search: do we check whether the next best distance is good enough? <br/></td></tr>
<tr class="separator:adbf81f0b21102b942182c904892e0858"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a857bef0db2dc0000f312cc8a95f857b2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a857bef0db2dc0000f312cc8a95f857b2"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a857bef0db2dc0000f312cc8a95f857b2">upper_beam</a></td></tr>
<tr class="memdesc:a857bef0db2dc0000f312cc8a95f857b2"><td class="mdescLeft">&#160;</td><td class="mdescRight">number of entry points in levels &gt; 0. <br/></td></tr>
<tr class="separator:a857bef0db2dc0000f312cc8a95f857b2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a683738e8ab8e67fcabd823510c30b074"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a683738e8ab8e67fcabd823510c30b074"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structfaiss_1_1HNSW.html#a683738e8ab8e67fcabd823510c30b074">search_bounded_queue</a> = true</td></tr>
<tr class="memdesc:a683738e8ab8e67fcabd823510c30b074"><td class="mdescLeft">&#160;</td><td class="mdescRight">use bounded queue during exploration <br/></td></tr>
<tr class="separator:a683738e8ab8e67fcabd823510c30b074"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock">
<p>Definition at line <a class="el" href="HNSW_8h_source.html#l00046">46</a> of file <a class="el" href="HNSW_8h_source.html">HNSW.h</a>.</p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a41a5d502f7b17a0fca8d1b0c02123a24"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::HNSW::add_links_starting_from </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1DistanceComputer.html">DistanceComputer</a> &amp;&#160;</td>
          <td class="paramname"><em>ptdis</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1HNSW.html#ae1342fc2f07c325598a73b733e88ee74">storage_idx_t</a>&#160;</td>
          <td class="paramname"><em>pt_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1HNSW.html#ae1342fc2f07c325598a73b733e88ee74">storage_idx_t</a>&#160;</td>
          <td class="paramname"><em>nearest</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>d_nearest</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>level</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">omp_lock_t *&#160;</td>
          <td class="paramname"><em>locks</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1VisitedTable.html">VisitedTable</a> &amp;&#160;</td>
          <td class="paramname"><em>vt</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Finds neighbors and builds links with them, starting from an entry point. The own neighbor list is assumed to be locked. </p>

<p>Definition at line <a class="el" href="HNSW_8cpp_source.html#l00441">441</a> of file <a class="el" href="HNSW_8cpp_source.html">HNSW.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a314b809de6f329662ab09f258b49afb3"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::HNSW::add_with_locks </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1DistanceComputer.html">DistanceComputer</a> &amp;&#160;</td>
          <td class="paramname"><em>ptdis</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>pt_level</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>pt_id</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; omp_lock_t &gt; &amp;&#160;</td>
          <td class="paramname"><em>locks</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1VisitedTable.html">VisitedTable</a> &amp;&#160;</td>
          <td class="paramname"><em>vt</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>add point pt_id on all levels &lt;= pt_level and build the link structure for them. </p>

<p>Definition at line <a class="el" href="HNSW_8cpp_source.html#l00477">477</a> of file <a class="el" href="HNSW_8cpp_source.html">HNSW.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ad91ac2e25c896dab7fb9d32f94b60a6a"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int faiss::HNSW::search_from_candidates </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1DistanceComputer.html">DistanceComputer</a> &amp;&#160;</td>
          <td class="paramname"><em>qdis</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>k</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1HNSW.html#a84f912f99bda1a827a74cdf8793af160">idx_t</a> *&#160;</td>
          <td class="paramname"><em>I</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float *&#160;</td>
          <td class="paramname"><em>D</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1HNSW_1_1MinimaxHeap.html">MinimaxHeap</a> &amp;&#160;</td>
          <td class="paramname"><em>candidates</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1VisitedTable.html">VisitedTable</a> &amp;&#160;</td>
          <td class="paramname"><em>vt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>level</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>nres_in</em> = <code>0</code>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Do a BFS on the candidates list </p>

<p>Definition at line <a class="el" href="HNSW_8cpp_source.html#l00523">523</a> of file <a class="el" href="HNSW_8cpp_source.html">HNSW.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="ae7d955690da5d6376c203e81e124ba94"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::HNSW::set_default_probas </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>M</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>levelMult</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>initialize the assign_probas and cum_nneighbor_per_level to have 2*M links on level 0 and M links on levels &gt; 0 </p>

<p>Definition at line <a class="el" href="HNSW_8cpp_source.html#l00076">76</a> of file <a class="el" href="HNSW_8cpp_source.html">HNSW.cpp</a>.</p>

</div>
</div>
<a class="anchor" id="a0cf1870a859783925e95b15bf5e83584"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void faiss::HNSW::shrink_neighbor_list </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structfaiss_1_1DistanceComputer.html">DistanceComputer</a> &amp;&#160;</td>
          <td class="paramname"><em>qdis</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::priority_queue&lt; <a class="el" href="structfaiss_1_1HNSW_1_1NodeDistFarther.html">NodeDistFarther</a> &gt; &amp;&#160;</td>
          <td class="paramname"><em>input</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">std::vector&lt; <a class="el" href="structfaiss_1_1HNSW_1_1NodeDistFarther.html">NodeDistFarther</a> &gt; &amp;&#160;</td>
          <td class="paramname"><em>output</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max_size</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Enumerate vertices from farthest to nearest from query, keep a neighbor only if there is no previous neighbor that is closer to that vertex than the query. </p>

<p>Definition at line <a class="el" href="HNSW_8cpp_source.html#l00235">235</a> of file <a class="el" href="HNSW_8cpp_source.html">HNSW.cpp</a>.</p>

</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a class="anchor" id="a1c258bb88aae9b1a754ab4690d85ed41"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;int&gt; faiss::HNSW::cum_nneighbor_per_level</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>number of neighbors stored per layer (cumulative), should not be changed after first add </p>

<p>Definition at line <a class="el" href="HNSW_8h_source.html#l00103">103</a> of file <a class="el" href="HNSW_8h_source.html">HNSW.h</a>.</p>

</div>
</div>
<a class="anchor" id="a27bd11ef9a651a94bcefa5291336fc58"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;<a class="el" href="structfaiss_1_1HNSW.html#ae1342fc2f07c325598a73b733e88ee74">storage_idx_t</a>&gt; faiss::HNSW::neighbors</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>neighbors[offsets[i]:offsets[i+1]] is the list of neighbors of vector i for all levels. this is where all storage goes. </p>

<p>Definition at line <a class="el" href="HNSW_8h_source.html#l00114">114</a> of file <a class="el" href="HNSW_8h_source.html">HNSW.h</a>.</p>

</div>
</div>
<a class="anchor" id="a0b456c521194903b29ce7c157539d771"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;size_t&gt; faiss::HNSW::offsets</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>offsets[i] is the offset in the neighbors array where vector i is stored size ntotal + 1 </p>

<p>Definition at line <a class="el" href="HNSW_8h_source.html#l00110">110</a> of file <a class="el" href="HNSW_8h_source.html">HNSW.h</a>.</p>

</div>
</div>
<hr/>The documentation for this struct was generated from the following files:<ul>
<li>/data/users/hoss/faiss/<a class="el" href="HNSW_8h_source.html">HNSW.h</a></li>
<li>/data/users/hoss/faiss/<a class="el" href="HNSW_8cpp_source.html">HNSW.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
